package com.smart.platform.service.impl;

import com.smart.platform.dao.OutcomeDao;
import com.smart.platform.entity.outcome_node.Outcome;
import com.smart.platform.utils.PageUtil;
import com.smart.platform.utils.QueryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OutcomeService {
    @Autowired
    private OutcomeDao outcomeDao;
    @Autowired
    private QueryUtil queryUtil;

    /**
     * @param
     * @return
     * @author zzp
     * @date 2012018/7/9:11:11
     */
    public PageUtil<Outcome> findAll(Outcome outcome, Integer page, Integer pageSize) {
        //排空，设置默认值
        if (page == null || "".equals(page) || "0".equals(page)) {
            page = 1;
        }
        if (pageSize == null || pageSize.equals("") || pageSize.equals("0")) {
            pageSize = 10;
        }
        StringBuffer sql = new StringBuffer();
        sql.append("SELECT\n" +
                "\t* \n" +
                "FROM\n" +
                "\toutcome o");
        PageUtil<Outcome> outcomelist = queryUtil.queryByPage(sql.toString(), Outcome.class, page, pageSize);
        return outcomelist;
    }
}
